home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
5
/
CHASSIS_
/
MAINDRAW.C
< prev
next >
Wrap
Text File
|
1992-05-20
|
3KB
|
108 lines
/************************************************************************************/
/* MainDrawProc */
/* This routine should be invoked between a BeginUpdate and EndUpdate sequence, */
/* usually after an Update event in the main event loop. */
/************************************************************************************/
#include "MyHeaders.h"
int MainDrawProc ()
{
int MainDrawRetCode = 0;
Rect IRect = {10,10, 42,42}; /* placement of icon bitmap */
Handle IHandle; /* handle to icon */
CIconHandle CIHandle; /* handle to icon */
PicHandle thePic; /* for background picture */
windSub = 0; /* point to window record */
SetPort (windTbl[windSub].windPtr); /* set as the grafPort */
/********************************************/
/* Example of displaying text from a */
/* resource file. THIS IS THE PREFERRED */
/* WAY OF DISPLAYING STATIC TEXT. */
/********************************************/
TextFont(geneva);
TextFace(NIL);
TextSize(10);
SetRect (&workRect, 10,52, 350,171);
workHandle = GetResource('TEXT', 128);
HLock(workHandle);
worklong = SizeResource(workHandle);
TextBox ((*workHandle), worklong, &workRect, teJustLeft);
HUnlock(workHandle);
/********************************************/
/* Example of writing version information */
/********************************************/
TextSize(9);
workRect = windTbl[0].windRec.port.portRect;
workRect.top = workRect.bottom - 26;
workRect.left +=4;
workRect.right -=4;
TextBox (&versLongStr[1], (long) versLongStr[0], &workRect, teJustLeft);
/********************************************/
/* Example of drawing text. */
/********************************************/
TextFont(geneva);
TextFace(bold);
TextSize(20);
MoveTo (65,35);
DrawString ("\pChassis");
/********************************************/
/* Example of displaying an icon from a */
/* resource file. */
/* myResRefNum is application's resource */
/* file reference number obtained near the */
/* beginning of the program. */
/********************************************/
UseResFile (myResRefNum);
if (useColor)
{
CIHandle = GetCIcon (128);
PlotCIcon (&IRect, CIHandle);
}
else
{
IHandle = GetResource ('ICN#', 128);
PlotIcon (&IRect, IHandle);
}
/********************************************/
/* Example of using drawing commands. */
/********************************************/
/****
SetRect (&workRect, 300,10, 340,50);
FrameRect (&workRect);
FrameOval (&workRect);
MoveTo (300,10);
Line (38,38);
MoveTo (339,10);
Line (-38,38);
****/
/********************************************/
/* Example of displaying a picture */
/* from a resource file. You can use this */
/* method to create a "background" picture. */
/********************************************/
/****
UseResFile (myResRefNum);
thePic = (PicHandle) GetResource ('PICT', 128);
workRect = (**thePic).picFrame;
DrawPicture (thePic,&workRect);
****/
return MainDrawRetCode;
}